﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DIS.Infrastructure.Entities.Repository;
using DIS.Infrastructure.Entities.Enum;
using DIS.Infrastructure.Entities.Cache;

namespace DIS.Infrastructure.Entities.Entity
{
    public class HotelFeeDetail : IAccessible<T_HotelFeeDetail, HotelFeeDetail>, ILogicEntity<T_HotelFeeDetail, HotelFeeDetail>
    {
        public int Id { get; set; }

        public int HotelId { get; set; }

        public string CheckInDate { get; set; }

        public string CheckOutDate { get; set; }

        public int Days { get; set; }

        public string TravelAddress { get; set; }

        public string HotelName { get; set; }

        public decimal Price { get; set; }

        public decimal TotalFee { get; set; }

        public int InvoiceCount { get; set; }

        public HotelFee hotelFee { get; set; }

        public HotelFeeDetail LoadHotelFee(T_HotelFee hotelFee)
        {
            this.hotelFee = new HotelFee().Set(hotelFee);
            return this;
        }

        public HotelFeeDetail LoadHotelFee(T_HotelFee hotelFee, T_User user)
        {
            this.hotelFee = new HotelFee().Set(hotelFee).LoadUser(user);
            return this;
        }

        protected override void Covariant(T_HotelFeeDetail model)
        {
            this.Id = model.Id;
            this.HotelId = model.HotelId;
            this.CheckInDate = model.CheckInDate;
            this.CheckOutDate = model.CheckOutDate;
            this.TravelAddress = model.TravelAddress;
            this.HotelName = model.HotelName;
            this.TotalFee = model.TotalFee;
            this.InvoiceCount = model.InvoiceCount;
            this.Days = model.Days;
            this.Price = model.Price;
        }
        protected override T_HotelFeeDetail Inverter(HotelFeeDetail model)
        {
            return new T_HotelFeeDetail()
            {
                Id = model.Id,
                HotelId = model.HotelId,
                CheckInDate = model.CheckInDate,
                CheckOutDate = model.CheckOutDate,
                TravelAddress = model.TravelAddress,
                HotelName = model.HotelName,
                TotalFee = model.TotalFee,
                InvoiceCount = model.InvoiceCount,
                Days = model.Days,
                Price = model.Price
            };
        }
        public HotelFeeDetail Set(T_HotelFeeDetail dbModel)
        {
            Covariant(dbModel);
            return this;
        }
    }
}
